#ifndef MYTHREAD_H
#define MYTHREAD_H

//#include <qthread.h>
#include <QtCore\qthread.h>
#include <qmutex.h>
#include <qtablewidget.h>

#include <iostream>
#include <vector>
#include <string>
#include "sql_Connector.h"
#include "Transaction.h"

#include <qdesktopservices.h>
#include <qurl.h>
#include <qfiledialog.h>
#include <fcntl.h>
#include <string>
#include <sstream>
#include <fstream>

#include "item.h"
#include <time.h>

#include "Hardware_handling.h"
#include <qstring.h>

using namespace std;
class MyThread: public QThread
{
	Q_OBJECT
private:
	vector<Transaction *> iList;
	void clearTransactList();
	QTableWidget *tabTransact;
	bool to_PriceDisplay;
	int pID;
public:
	bool stop;
	string name;
	MyThread(void);
	MyThread(QTableWidget *toUpdate);
	~MyThread(void);
	void run();
	void getTransactList(vector<Transaction *> &iGet);
signals:
	void NumberChanged(int);

public slots:
		void sendPID(QString pID_in);
		// Called when dynamic pricing, update new info to all price displays
		void pid_new_info( void);
private:
	void Initialize();
	string Intepret(char buffer[],size_t len_buf);
	string getPrice(char buffer[]);
	string getInfo(char buffer[]);
	bool is_number(const std::string& s);
	int getTotalPID();
};

#endif

